﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

///<summary>
///
///</summary>
public class StartState : State
{
    public override void ExecuteState(StateManager manager)
    {
        if (manager.IsSkipGameScnen)
        {
            ExitState(manager);
        }      
    }
    public override void ExitState(StateManager manager)
    {
        if (manager.IsSkipGameScnen)
        {
            SceneManager.sceneLoaded += OnSceneLoaded;
            SceneManager.LoadScene("Game");
			AudioManager.GetInstance.Play("Sounds/Start/woosh");
            StateManager.GetInstance.SetState(new GameState());
            Debug.Log("转Game场景");
        }           
    }
    public override void InitState(StateManager manager)
    {
        manager.IsSkipStartScnen = false;
    }
    void OnSceneLoaded(Scene scene, LoadSceneMode mode)
    {
        SendNotification(GameEvents.GAME_AWAKE_COMMAND);
        SceneManager.sceneLoaded -= OnSceneLoaded;
    }
}
